//登录按钮事件
import {loge,reg} from "/data/logoin.js"
// let serverUrl = "http://localhost:1314";
$("#logoin_btn").on("click", async () => {
    let user = {
        username: $("#user_name").val(),
        pwd: $("#user_pwd").val()
    };
    let data = await loge(user);
    alert(data.msg);
    if (data.status === 200) {
        //将登录成功的用户名，添加到sessionStronge里
        sessionStorage.setItem('username',user.username);
        location.href = '/html/uesrlist.html';
    }
});

// 注册按钮事件
$('#reg_btn').on('click', async () => {
    let user = {
        username: $("#user_pwd").val(),
        pwd: $("#user_pwd").val()
    };
    let data = await reg(user);
    alert(data.msg);
});